<!--  -->
<template>
    <div>既往病史
   
    <el-checkbox-group @change="handleCheckedChange" v-model="checkList">
      <el-checkbox v-for="item in list" :label="item.name" :value="item.name" />
    </el-checkbox-group>
  
    </div>
  </template>
  
  <script lang='ts' setup>
  import { reactive,toRefs,ref,onMounted, inject} from 'vue'
  import { getDiseaseList } from '../../apis/elderly/disease';
  import { Disease, Elderly } from '../../apis/elderly/type';
  
  const elderly=inject<Elderly>("elderly")!;
  
  const list=ref<Disease[]>([]);
  
  const checkList=ref<string[]>([]);
  const getData=async ()=>{
      const res=await getDiseaseList();
      list.value=res.data.list;
  }
  
  const handleCheckedChange=()=>{
      elderly.health.oldillness=checkList.value.join(",");
  
  }
  getData();
  </script>
  <style scoped>
  </style>